#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
	float price = 0;
	int month = 0;
	int day = 0;
	int coupon = 0;
	scanf("%f %d %d %d", &price, &month, &day, &coupon);

	if (month == 11 && day == 11)
	{
		price = price * 0.7;
	}

	else
	{
		price *= 0.8;
	}

	if (coupon == 1)
	{
		price = price - 50;
		if (price<0)
			price = 0;

		printf("%.2f", price);

	}
	else
		printf("%.2f", price);


	return 0;
}